package com.baitiaojun.elasticsearch.api;

import com.baitiaojun.api.domain.video.Video;
import com.baitiaojun.api.exception.ConditionException;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 * @类名 ElasticsearchVideoApi
 * @描述 TODO
 * @作者 白条君
 * @创建日期 2022/12/20 23:20
 * @版本 1.0
 */
@RequestMapping("/elasticsearch")
public interface VideoApi {

    @PostMapping("/new-video")
    void saveVideo(@RequestBody Video video) throws ConditionException;

    @GetMapping("/home-video")
    List<Video> getPageHomeVideoList(@RequestParam("lastId") Long lastId
            , @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "area") String... area) throws IOException;

    @PutMapping("/update-view-count")
    void updateViewCount(@RequestBody List<Long> videoIds) throws IOException;

    @DeleteMapping("/cancel-video")
    void removeVideo(@RequestParam("id") Long id);
}
